package com.gjy.concurrency.use;

import org.junit.jupiter.api.Test;

import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2023-03-08 10:21:02
 */
public class Random2Test {

    @Test
    public void test2() {
        ThreadLocalRandom current = ThreadLocalRandom.current();
        for (int i = 0; i < 10; i++) {
            System.out.println("current.nextInt(5) = " + current.nextInt(5));
        }
    }

    @Test
    public void test1() {
        Random random = new Random();
        for (int i = 0; i < 10; i++) {
            System.out.println("random.nextInt(5) = " + random.nextInt(5));
        }
    }
}
